﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Avaliacao
{
    class GameButton : GameObject
    {
        protected Rectangle buttonArea;
        protected List<Animation> animations;
        protected int currentAnimation;
        public enum animIndexes { Still, Hover, Clicked };

        public Rectangle ButtonArea
        {
            get { return this.buttonArea; }
            set { this.buttonArea = value; }
        }

        public GameButton(Texture2D texture, GameWindow Window, Vector2 position, int width, int height) : base(texture, Window)
        {
            this.position = position;
            this.buttonArea = new Rectangle((int)position.X, (int)position.Y, width, height);

            Animation still = new Animation();
            still.width = width;
            still.height = height;
            still.frames = 1;
            still.frames_per_second = 1;
            still.Y = 0;
            still.name = "Still";

            Animation hover = new Animation();
            hover.width = width;
            hover.height = height;
            hover.frames = 1;
            hover.frames_per_second = 1;
            hover.Y = 1;
            hover.name = "Hover";

            Animation clicked = new Animation();
            clicked.width = width;
            clicked.height = height;
            clicked.frames = 1;
            clicked.frames_per_second = 1;
            clicked.Y = 2;
            clicked.name = "Click";

            this.animations = new List<Animation>();
            this.animations.Add(still);
            this.animations.Add(hover);
            this.animations.Add(clicked);
            this.currentAnimation = (int)GameButton.animIndexes.Still;
        }

        public override void Update(GameTime gameTime)
        {
        }

        public void setAnimation(int index)
        {
            this.currentAnimation = index;
        }

        public Animation getAnimation()
        {
            return animations.ElementAt(currentAnimation);
        }

        public int getAnimationIndex()
        {
            return currentAnimation;
        }
    }
}
